# Contributor: Jared Szechy <jared.szechy@gmail.com>
# Maintainer: Jared Szechy <jared.szechy@gmail.com>
pkgname=librtlsdr
pkgver=0.6.0
pkgrel=3
pkgdesc="Software defined radio receiver for Realtek RTL2832U"
url="https://osmocom.org/projects/sdr/wiki/rtl-sdr"
arch="all"
license="GPL-2.0"
options="!check" # no tests
depends_dev="libusb-dev"
makedepends="$depends_dev cmake samurai"
subpackages="$pkgname-dev rtl-sdr:tools"
source="$pkgname-$pkgver.tar.gz::https://github.com/steve-m/librtlsdr/archive/$pkgver.tar.gz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX:PATH=/usr \
		-DDETACH_KERNEL_DRIVER=ON \
		-DINSTALL_UDEV_RULES=ON \
		-Wno-dev \
		.
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

tools() {
	pkgdesc="Software defined radio receiver for Realtek RTL2832U (tools)"
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}

sha512sums="a08356a08672f03d86adb662e28923e7998b78c0f49432dc1b1e3844976158c467242e0c5eabf206fd257bdebcf91cd2767dabf13d2ef475f2f3e1d82e23ed75  librtlsdr-0.6.0.tar.gz"
